<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="qw">
    <p>1</p>
    <p>2</p>
    <p>3</p>
    <p>4</p>
    <p>5</p>
    <script>
      // 创建新节点
      var div = document.createElement("div");
      console.dir(div)

      var cl = document.createAttribute("qqq");
      cl.value ="hhhk"
      console.dir(cl);

      var txt =document.createTextNode("text1");
      console.dir(txt)
      div.innerText = txt.nodeValue;
      div.className = cl.nodeValue
      div.setAttribute("age",18)
      // 插入节点
      document.body.appendChild(div);
      var dv =document.getElementById("qw");
      dv.appendChild(div)
    </script>
  </div>
</body>
</html>